package com.zzyk.microCloud.controller;

import com.zzyk.main.model.vo.Message;
import com.zzyk.main.service.WebSocketService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @description:
 * @author: wss_PC
 * @time: 2020/11/4 17:39
 */
@RestController
@RequestMapping("/message")
public class MessageController {
    /**
     * 当发生报警通知
     * @param message
     * @return
     * @throws IOException
     */
    @RequestMapping("/notice")
    public Message notice(String message) throws IOException {
        WebSocketService.sendMessageToAll(message);
        return Message.success();
    }
}
